<html>
    <!-- DW6 -->
    <head>

        <title>Edit Purchase</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <link href="../../images/mm_health_nutr.css" rel="stylesheet" type="text/css">
        <style type="text/css">
            <!--
            .style1 {
                font-size: 12px;
                font-weight: bold;
            }
            a:link {
                text-decoration: none;
            }
            a:visited {
                text-decoration: none;
            }
            a:hover {
                text-decoration: none;
            }
            a:active {
                text-decoration: none;
            }
            a {
                font-weight: bold;
            }
            -->
        </style>
    </head>
    <body bgcolor="#F4FFE4">
        <table width="102%" border="0" cellspacing="0" cellpadding="0">
            <tr bgcolor="#D5EDB3">
                <td width="250" rowspan="2" >&nbsp;</td>
                <td width="568" height="55" align="center" valign="bottom" nowrap="nowrap"  class="pageName" id="logo">Stores and Material Management</td>
                <td width="180" >&nbsp;</td>
            </tr>
            <tr bgcolor="#D5EDB3">
                <td height="43" align="center" valign="top"  id="tagline">&nbsp;</td>
                <td width="180" >&nbsp;</td>
            </tr>
            <tr>
                <td colspan="3" bgcolor="#5C743D"></td>
            </tr>
            <tr>
                <td colspan="3" bgcolor="#99CC66" ></td>
            </tr>
            <tr bgcolor="#99CC66">
                <td height="28" ><a href="../Entries.jsp"><strong>HOME</strong></a>&nbsp;::&nbsp;<a href="PurchaseHome.jsp"><strong>BACK</strong></a>&nbsp;&nbsp;&nbsp;&nbsp;
                    <script language="JavaScript" type="text/javascript">
                        document.write(TODAY);	</script></td>
                <td height="28" align="center" ><a href="../../masters/Masters.jsp">Masters</a> <a href="../Entries.jsp">Entries</a> <a href="../../reports/AdminReporting.jsp">Reports</a></td>
                <td height="28" >&nbsp;</td>
            </tr>

            <tr>
                <td colspan="3" bgcolor="#5C743D"><img src="../../images/mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
            </tr>

            <tr><td colspan="3" bgcolor="#5C743D"><img src="../../images/mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
                <th height="536" colspan="3" valign="top" bgcolor="#536A3E">

                    <p>
                        <%
  		
                                 String pid=request.getParameter("pid");
                                 request.getSession(true);
                                 db.connect();
                                 session.setAttribute("pid",pid);
                                 String loc=session.getAttribute("loc").toString();
                        %>
                    </p>
                    <form name="form1" action="../../pAction.jsp">

                        <table width="627" border="1" cellpadding="1" cellspacing="1">
                            <tr>
                                <td height="27" colspan="9" ><span class="style1">Purchase id <%=pid%></span></td>
                            </tr>
                            <tr>
                                <td width="59" height="27" ><span class="style1">Item Name </span></td>
                                <td width="178" ><span class="style1">Qty</span></td>
                                <td width="16" ><span class="style1">Rate</span></td>
                                <td width="16" ><span class="style1">Tax</span></td>
                                <td width="16" ><span class="style1">Ed</span></td>
                                <td width="16" ><span class="style1">S.CESS</span></td>
                                <td width="16" ><span class="style1">FI</span></td>
                                <td width="16" ><span class="style1">Vat</span></td>
                                <td ><span class="style1">Discount</span></td>
                            </tr>
                            <%
                                  String item_name="";
                                  double qty=0.0,rate=0.0,tax=0.0,ed=0.0,sces=0.0,fi=0.0,vat=0.0,disc=0.0;
                                  Vector v=new Vector();
                                  String q="select iname,qty,rate,tax,ed,sces,fi,vat,discount from purchase where pid='"+pid+"' and location='"+loc+"'";
                                  ResultSet qrs=db.execSQL(q);
		
                                  while (qrs.next()==true)
                                  {
                                  item_name=qrs.getString(1);
                                  v.add(item_name);
                                  item_name=item_name.replaceAll("\"","&quot;");
                                  qty=qrs.getDouble(2);
                                  rate=qrs.getDouble(3);
                                  tax=qrs.getDouble(4);
                                  ed=qrs.getDouble(5);
                                  sces=qrs.getDouble(6);
                                  fi=qrs.getDouble(7);
                                  vat=qrs.getDouble(8);
                                  disc=qrs.getDouble(9);
                            %>

                            <tr>
                                <td>

                                    <select name="item"><%
                                                      String q12="select itemname from items";
                                                      ResultSet rs2=db.execSQL(q12);
                                                      db.connect();
                                                      while (rs2.next()==true)
                                                      {
                                                      String item_name12=rs2.getString(1);
                                                      String item_name1=item_name12.replaceAll("\"","&quot;");
                                                            if (item_name1.equals(item_name))
                                                            {
                                        %>
                                        <option selected="selected"><%=item_name1%></option>
                                        <%}else if (!item_name1.equals(item_name))
					 {%><option><%=item_name1%></option> <%}%>


                                    <%}%>	 </select>		</td>
                                <td><input name="qty" type="text" value="<%=qty%>" size="12"></td>
                                <td><input name="rate" type="text" id="rate" value="<%=rate%>" size="12"></td>
                                <td><input name="tax" type="text" id="tax" value="<%=tax%>" size="12"></td>
                                <td><input name="ed" type="text" id="ed" value="<%=ed%>" size="12"></td>
                                <td><input name="sces" type="text" id="sces" value="<%=sces%>" size="12"></td>
                                <td><input name="fi" type="text" id="fi" value="<%=fi%>" size="12"></td>
                                <td><input name="vat" type="text" id="vat" value="<%=vat%>" size="12"></td>
                                <td><input name="disc" type="text" id="disc" value="<%=disc%>" size="12"></td>
                            </tr>
                            <%}session.setAttribute("item_name",v);%>
                            <tr>
                                <td colspan="12" align="center"><label>
                                        <input type="submit" name="Submit" value="Submit">
                                    </label></td>
                            </tr>
                        </table>
                    </form>  </th>

            <tr>
                <td colspan="3"></td>
            </tr>
        </table>
    </body>
</html>
